<template>
	<view class="userLayout pageBg">
		<view class="userInfo">
			<view class="avator">
				<image src="../../static/cute.jpg" mode="aspectFill"></image>
			</view>
			<view class="ip">
				114.514.1919.810
			</view>
			<view class="address"> from{{}} </view>
		</view>

		<view class="section">
			<view class="list">
				
				<!-- 跳转写法1 -->
				<view class="row" @click="toUrl('../../pages/classlist/classlist')">
					<view class="left">
						<uni-icons type="download-filled" size="16"></uni-icons>
						<view class="leftText"> leftText </view>
					</view>
					<view class="right">
						<uni-icons type="right" size="16"></uni-icons>
						<view class="rightText"> rightText </view>
					</view>
				</view>
				
				<view class="row" @click="toUrl('../../pages/preview/preview')">
					<view class="left">
						<uni-icons type="download-filled" size="16"></uni-icons>
						<view class="leftText"> debug: to preview </view>
					</view>
					<view class="right">
						<uni-icons type="right" size="16"></uni-icons>
						<view class="rightText"> rightText </view>
					</view>
				</view>
				
				<!-- 跳转写法2 -->
				<!-- <view class="row" v-for="(item,index) in list " :key="index" @click="toPage(index)"> -->
				<view class="row" @click="toPage(0)">
					<view class="left">
						<uni-icons type="download-filled" size="16"></uni-icons>
						<view class="leftText"> leftText </view>
					</view>
					<view class="right">
						<uni-icons type="right" size="16"></uni-icons>
						<view class="rightText"> rightText </view>
					</view>
				</view>

				<view class="row">
					<view class="left">
						<uni-icons type="download-filled" size="16"></uni-icons>
						<view class="leftText"> leftText </view>
					</view>
					<view class="right">
						<uni-icons type="right" size="16"></uni-icons>
						<view class="rightText"> rightText </view>
					</view>

					<!-- #ifdef MP -->
					<!-- 小程序：联系客服： -->
					<button open-type="contact"> contact kefu </button>
					<!-- #endif -->

					<!-- #ifdef H5 -->
					<!-- H5:拨打电话 -->
					<button @click="onPhoneClick"> telephone </button>
					<!-- #endif -->

				</view>

			</view>
		</view>


		<view class="section">
			<view class="list">
				<view class="row" v-for="item in 2">
					<view class="left">
						<uni-icons type="download-filled" size="16"></uni-icons>
						<view class="leftText"> leftText </view>
					</view>
					<view class="right">
						<uni-icons type="right" size="16"></uni-icons>
						<view class="rightText"> rightText </view>
					</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script setup>
	const onPhoneClick = function() {
		uni.makePhoneCall({
			phoneNumber: "114514-1919810"
		})
	}
	
	// 跳转写法1
	const toUrl=(url)=>{
		uni.navigateTo({
			url:`${url}`
		})
	}
	
	// 跳转写法2
	const PageList = [{
		name: '首页',
		url: '/pages/classlist/classlist'
	}, {
		name: '首页',
		url: '/pages/classlist/classlist'
	}, {
		name: '首页',
		url: '/pages/classlist/classlist'
	}, ]

	const toPage=(idx)=>{
		uni.navigateTo({
			url:`${PageList[idx].url}`
		})
	}
</script>

<style lang="scss" scoped>
	.userLayout {
		.userInfo {
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction: column;
			padding: 50rpx 0;

			.avator {
				width: 150rpx;
				height: 150rpx;
				border-radius: 50%;
				overflow: hidden;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.ip {
				font-size: 44rpx;
				font-size: #333;
				padding: 20rpx;
			}

			.address {
				font-size: 20rpx;
				color: #aaa;
			}
		}

		.section {
			width: 690rpx;
			margin: 50rpx auto;
			border: 1px solid #eee;
			// border: 10rpx solid red;
			border-radius: 20rpx;
			box-shadow: 0 0 30rpx rgba(0, 0, 0, 0.2);

			:deep() {
				.uni-icons {
					color: $theme-green !important;
				}
			}

			.list {
				.row {
					display: flex;
					// justify-content: flex-start; /* 子元素从左到右排列 */
					justify-content: space-between;
					align-items: center;
					padding: 0 30rpx;
					height: 100rpx;
					border-bottom: 1px solid #eee;

					position: relative;

					&:last-child {
						border-bottom: 0;
					}

					.left {
						display: flex;
						align-items: center;

						.leftText {
							padding-text: 20rpx;
							color: #777;
						}
					}

					.right {
						display: flex;
						align-items: center;

						.rightText {
							padding-text: 20rpx;
							color: #777;
						}
					}

					button {
						position: absolute;
						top: 0;
						left: 0;
						height: 100rpx;
						width: 100%;
						z-index: 114514;
						// display: none;
						opacity: 0.7;
					}
				}
			}
		}
	}
</style>